package com.itheima.controller;

import com.itheima.common.R;
import com.itheima.entity.Orders;
import com.itheima.serivce.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RequestMapping("order")
@RestController
public class OrderController {
    @Autowired
    private OrderService orderService;


    @PostMapping("submit")
    public R submit(@RequestBody Orders order) {
        log.info("订单数据:{}",order);
        orderService.submit(order);

        return R.success("下单成功");
    }
}
